package com.atguigu1.one.exer3;

import java.util.Scanner;

/**
 * ClassName: score
 * Description:
 *
 * @Author liu
 * @Create 2024/8/10 16:13
 * @Version 1.0
 */

public class score {
    public static void main(String[] args) {
        // 定义数组
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入学生人数");
        int man = scanner.nextInt();
        int[] student = new int[man];
        //遍历数组
        //找到最大数
        int max = student[0];
        System.out.println("请输入"+man+"个成绩");
        for (int i = 0; i <student.length ; i++) {
            student[i] = scanner.nextInt();
            if(student[i] > max){
                max = student[i];
            }
        }
        // 再遍历数组，判别等级
        char grade =0;
        for (int i = 0; i <student.length ; i++) {
            if(student[i] >= max - 10)
                grade = 'A';
            else if(student[i] >= max - 20)
                grade = 'B';
            else if(student[i] >= max - 30)
                grade = 'C';
            else
                grade = 'D';
            System.out.println("student "+(i+1)+" score is "+student[i]+" grade is "+grade);
        }

    }
}
